package user;

import operate.*;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-23
 * Time: 22:04
 */
public class NormalUser extends User{

    public NormalUser(String name) {
        super(name);
        super.setIoperates(new Ioperate[]{new ExitOperate(),new BorrowOperate(),
                           new SearchOperate(),new ReturnOperate()});
    }

    @Override
    public int menu() {
        System.out.println("**********************************************");
        System.out.println(super.getName() + "欢迎来的图书管理系统");
        System.out.println("请选择下面操作：");
        System.out.println("0.退出系统");
        System.out.println("1.借阅图书");
        System.out.println("2.搜索图书");
        System.out.println("3.归还图书");
        System.out.println("*********************************************");
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.print("请选择：");
            int choice = scanner.nextInt();
            if (choice >= 0 && choice <= 3){
                return choice;
            }
            System.out.println();
            System.out.println("输入错误，请重新输入");
        }
    }

}
